package br.com.naybee.framework.client.componente.gwt.web;

import com.google.gwt.dom.client.DivElement;
import com.google.gwt.dom.client.Element;
import com.google.gwt.event.dom.client.ClickEvent;
import com.google.gwt.event.dom.client.ClickHandler;
import com.google.gwt.event.dom.client.HasClickHandlers;
import com.google.gwt.event.shared.HandlerRegistration;
import com.google.gwt.user.client.DOM;
import com.google.gwt.user.client.ui.ComplexPanel;
import com.google.gwt.user.client.ui.Widget;

public class Div extends ComplexPanel implements HasClickHandlers {

	private DivElement elementDiv = DOM.createDiv().cast();
	private String value;

	public Div() {
		setElement(elementDiv);
	}

	public void add(Widget w) {
		Element element = this.elementDiv;
		this.add(w, element);
	}

	public void setClassId(String identificador) {
		elementDiv.setId(identificador);
	}

	public String getClassId() {
		return elementDiv.getId();
	}

	public void setClassName(String classe) {
		elementDiv.setClassName(classe);
	}

	public String getClassName() {
		return elementDiv.getClassName();
	}

	public void setTitle(String titulo) {
		elementDiv.setTitle(titulo);
	}

	public String getTitle() {
		return elementDiv.getTitle();
	}

	public void setText(String texto) {
		this.elementDiv.setInnerText(texto);
	}

	public String getText() {
		return this.elementDiv.getInnerText();
	}

	public void setValue(String value) {
		this.value = value;
	}

	public String getValue() {
		return this.value;
	}

	public HandlerRegistration addClickHandler(ClickHandler handler) {
		return addDomHandler(handler, ClickEvent.getType());
	}

}
